import { getText } from '@/api/zStudyRequest'

const moduleA = {
    namespaced: true,  // 开启命名空间。这样在页面中使用辅助函数时，才可以直接根据模块名称找到对应模块中得数据。
    state: () => ({
        dange: 90,
        text: ''
    }),
    getters: {
        heandDange(state) {
            return state.dange + 10
        }
    },
    mutations: {
        changeState(state, payload) {
            state.dange = state.dange + payload
        },
        chengeText(state, payload) {
            state.text = payload
        }
    },
    actions: {
        async commitChengeText({ commit }, payload) {
            const res = await getText('/getText', payload)
            if (res.message == 'success') {
                let content = res.textCont.cparagraph
                commit('chengeText' , content)
                sessionStorage.setItem('textCont',JSON.stringify(content))
            }
        }
    }
}
export { moduleA }